import baseEntity from "./baseEntity";
export default class ProjectDef extends baseEntity {
  constructor(options) {
    super(options);
    this.PCode = options.PCode;
    this.PName = options.PName;
    this.PState = options.PState;
    this.Province = options.Province;
    this.Opponent = options.Opponent;
    this.Duration = options.Duration;
    this.StartDate = options.StartDate;
    this.EndDate = options.EndDate;
    this.Amount = options.Amount;
    this.Lng = options.Lng;
    this.Lat = options.Lat;
    this.FundManager = options.FundManager;
    this.AmountManager = options.AmountManager;
    this.OverViewImg = options.OverViewImg;
    this.StructViewImg = options.StructViewImg;
  }
  static loadList() {
    return new Promise((resolve, reject) => {
      getApp().globalData.api.http_get(`${getApp().globalData.baseUrl}/api/sys/projectdef`)
        .then(
          res => {
            console.log(res);
            let list = [];
            res.forEach(x => {
              list.push(new ProjectDef(x));
            });
            getApp().globalData.projects = list;
            getApp().globalData.nowPrj = list[0];
            resolve(list);
          }
        )
    })
  }
}
